<!--
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
   /* 从数组和对象中提取值，
    对变量进行赋值，
    这被称为解构（Destructuring）*/
   //1.基本用法 数组解构赋值-&#45;&#45;对象 数组……
/*    let [name, age, sex] = ['zhangsan', 14, 'fem'];
   console.log(name);
   console.log(age);
   console.log(sex);*/



</script>
</body>
</html>-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="bs/css/bootstrap.css">
    <style>
        body{
            background-color: #e8e8e8;
        }
    </style>
</head>
<body>
<div id="app">
    <div class="row">
        <div class="col-xs-8 col-xs-offset-2">
            <div class="page-header">
                <h1>itlike撩课</h1>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-xs-2 col-xs-offset-2">
            <div class="list-group">
                <!-- 使用 router-link 组件来导航. -->
                <!-- 通过传入 `to` 属性指定链接. -->
                <!-- <router-link> 默认会被渲染成一个 `<a>` 标签 -->
                <router-link class="list-group-item"  to="/h5">HTML5学院</router-link>
                <router-link class="list-group-item"  to="/java">Java学院</router-link>
                <router-link class="list-group-item"  to="/python">Python学院</router-link>
            </div>
        </div>
        <div class="col-xs-6">
            <div class="panel">
                <div class="panel-body">
                    <!-- 路由出口 -->
                    <!-- 路由匹配到的组件将渲染在这里 -->
                    <router-view></router-view>
                </div>
            </div>
        </div>
    </div>
</div>


<template id="h5">
    <div>
        <h2>HTML5学院</h2>
        <p>掌握面向未来的神技!</p>
        <img src="1.jpg" alt="" width="250">
    </div>
</template>

<template id="java">
    <div>
        <h2>Java学院</h2>
        <p>都说Java是世界上最好的语言!</p>
        <img src="1.jpg" alt="" width="250">
    </div>
</template>

<template id="python">
    <div>
        <h2>Python学院</h2>
        <p>现在好火热呀!</p>
        <img src="1.jpg" alt="" width="250">
    </div>
</template>

<script src="js/vue.js"></script>
<script src="js/vue-router.js"></script>
<script>
    // 1.创建组件
    const  Html5 = Vue.extend({
        template: '#h5'
    });

    const  Java = Vue.extend({
        template: '#java'
    });

    const  Python = Vue.extend({
        template: '#python'
    });

    // 2. 定义路由
    const routes = [
        {path:'/h5', component: Html5},
        {path:'/java', component: Java},
        {path:'/python', component: Python},
        // 配置根路由
        {path:'/', redirect: '/h5'}
    ];

    // 3. 创建路由实例
    const router = new VueRouter({
        routes
    });

    // 4.创建Vue的实例,并挂载
    new Vue({
        router
    }).$mount('#app')
</script>
</body>
</html>